package ace.module.account.sdk.core.feign.impl;

import ace.cmp.core.model.R;
import ace.cmp.openfeign.security.oauth2.core.config.FeignInternalServerOauth2SecurityConfig;
import ace.module.account.api.model.dto.IamApplicationDto;
import ace.module.account.sdk.core.feign.IamApplicationFeignApi;
import ace.module.common.api.annotation.ApiRemoteProxyPriority;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import ace.module.account.sdk.core.constant.SdkConstant;

/**
* 账户应用 rpc feign.
*
* @author Caspar
*/
@FeignClient(
    name = "${spring.cloud.openfeign.client.config.iamApplicationFeign.name:" + SdkConstant.FEIGN_SERVICE_NAME + "}",
    contextId = "iamApplicationFeign",
    path = IamApplicationFeign.PATH,
    configuration = FeignInternalServerOauth2SecurityConfig.class,
    primary = false
)
@ApiRemoteProxyPriority
public interface IamApplicationFeign extends IamApplicationFeignApi {
  String PATH = "${spring.cloud.openfeign.client.config.iamApplicationFeign.path:/account/iam-application/rpc}";

  @GetMapping("/getByOutTypeAndOutId")
  R<IamApplicationDto> getByOutTypeAndOutId(
      @Valid @NotEmpty @RequestParam("outType") String outType,
      @Valid @NotEmpty @RequestParam("outId") String outId);

  @GetMapping("/getAndCheckByOutTypeAndOutId")
  R<IamApplicationDto> getAndCheckByOutTypeAndOutId(
      @Valid @NotEmpty @RequestParam("outType") String outType,
      @Valid @NotEmpty @RequestParam("outId") String outId);
}
